﻿@model AddTempProductModel

@{
    ViewBag.Title = "上传物料";
    Layout = "~/Views/Shared/_ContentLayout.cshtml";
}
@{
    var viewModel = Model ?? new AddTempProductModel();
}
<form id="S_Form" action="@Url.Action("SupplierAddMoreTempProduct","TempProduct")" method="post" class="definewidth m20" enctype="multipart/form-data">
    <table class="table table-bordered table-hover definewidth m10">
        <tr>
            <td colspan="2">
                <h5>
                    供应商自助批量上传物料，物料上传格式请参照模板：<a href="@(ConfigHelper.AppSetting<string>("supplier_template_url"))">下载模板</a>
                </h5>
            </td>
        </tr>
        <tr>
            <td class="tableleft" style="width:100px;">操作序号</td>
            <td><input type="text" readonly name="batch" maxlength="50" value="@DateTime.Now.ToString(5)"/></td>
        </tr>

        <tr>
            <td class="tableleft">上传文件</td>
            <td id="uploadImg">
                <div class="upload_zipfile">
                    <input type="file" name="File" onchange="handleFilesZip(this.files,'inputFileSrc1')" >
                    <span id="inputFileSrc1"></span>
                </div>
            </td>
        </tr>
        <tr>
            <td class="tableleft"></td>
            <td>
                <p><span id="spMsg"></span></p>
                <button type="submit" class="btn btn-primary">保存</button> &nbsp;&nbsp;
                <button type="button" class="btn btn-success" onclick="document.location='@Url.Action("SupplierMoreTempProductList","TempProduct")'">返回列表</button>
            </td>

        </tr>
    </table>
    <script>
        BUI.use('bui/overlay', function (overlay) {
            $(function () {
                var rules = {
                    'batch': { required: true },
                    'File': { required: true }
                };
                var messages = {
                    
                };

                var validator = $('form').validate({
                    errorLabelContainer: $("#errorContainer"),
                    errorElement: "span",
                    rules: rules,
                    messages: messages,
                    submitHandler: function (form) {
                        $(".btn-primary").enable(false);
                        $(form).ajaxSubmit(function (result) {
                            $(".btn-primary").enable(true);
                            ShowActionResult(result, function () { window.location.reload(); });
                        });
                    }
                });

            });
        });



    </script>
</form>
